<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            padding: 0;
            margin: 0;
            box-sizing: border-box;
        }
        #app{
            padding: 5vw;
        }
        input{
            width: 75vw;
            height: 10vw;
            border-radius: 5vw;
            outline: none;
            border: none;
            background: #f5f5f5;
            padding-left: 5vw;
        }
        .l_search{
            display: flex;
            flex-wrap: wrap;
            margin-bottom: 5vw;
        }
        .l_search span{
            display: inline-block;
            height: 5vw;
            border-radius: 2.5vw;
            background: gray;
            margin: 1vw;
        }
    </style>
</head>
<body>
    <div id="app">
        <input type="text" v-model="searchText">
        <span @click="search()">搜索</span>
        <h4>历史搜索</h4>
        <div class="l_search">
            <span v-for="(item,index) in searchData">{{item}}</span>
        </div>
        <h4>搜索发现</h4>
        <div class="l_search">
            <span v-for="(item,index) in tryData">{{item}}</span>
        </div>
        
    </div>
</body>
</html>
<script src="../vue-2.5.21.js"></script>
<script>
    var vm = new Vue({
        el:'#app',
        data:{
            searchText:'',
            searchData:['天天新鲜（立水桥店）'],
            tryData:['麻辣烫','麻辣烫','米线','披萨','雪糕','汉堡','腊八粥','烤肉拌饭','炸鸡','味多美']
        },

        methods:{
            search(){
                this.searchData.unshift(this.searchText)
                this.searchText=''
            }
        }
    })
</script>